package com.cyj.dream.admin.service.system.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cyj.dream.admin.model.request.SysContactsQueryRequest;
import com.cyj.dream.admin.model.system.SysContacts;
import com.cyj.dream.admin.persistence.manager.systems.SysContactsManager;
import com.cyj.dream.admin.service.system.SysContactsService;
import com.cyj.dream.core.constant.pagemodel.PageParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 通讯录服务实现类
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.service.impl
 * @Author: ChenYongJia
 * @CreateTime: 2021-05-19 15:33
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Slf4j
@Service
public class SysContactsServiceImpl implements SysContactsService {

    @Autowired
    private SysContactsManager sysContactsManager;

    /**
     * 分页查询通讯录信息
     *
     * @param pageParam 分页参数以及入参
     * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dream.DreamChardonnay.model.system.SysContacts>
     * @date 2021/5/20 9:47
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public IPage<SysContacts> list(PageParam<SysContactsQueryRequest> pageParam) {
        Page<SysContacts> page = new Page<>(pageParam.getPageNum(), pageParam.getPageSize());
        IPage<SysContacts> dbPage = sysContactsManager.list(page, pageParam.getParam());
        return dbPage;
    }

    /**
     * 不分页查询通讯录信息
     *
     * @param param 参数以及入参
     * @return java.util.List<com.dream.DreamChardonnay.model.system.SysContacts>
     * @date 2021/7/1 16:11
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public List<SysContacts> allSysContactsByParam(SysContactsQueryRequest param){
        return sysContactsManager.allSysContactsByParam(param);
    }

    /**
     * 根据通讯录id查询通讯录信息
     *
     * @param sysContacts 通讯录对象
     * @return com.dream.DreamChardonnay.model.system.SysContacts
     * @date 2021-5-19 15:42:03
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public SysContacts selectBySysContactsId(SysContacts sysContacts) {
        return sysContactsManager.selectBySysContactsId(sysContacts);
    }

    /**
     * 添加通讯录信息
     *
     * @param sysContacts 通讯录对象
     * @return boolean
     * @date 2021/5/19 16:04
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean addSysContacts(SysContacts sysContacts) {
        return sysContactsManager.addSysContacts(sysContacts);
    }

    /**
     * 修改通讯录信息
     *
     * @param sysContacts 通讯录对象
     * @return boolean
     * @date 2021/5/19 16:04
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean updateSysContacts(SysContacts sysContacts) {
        return sysContactsManager.updateSysContacts(sysContacts);
    }

    /**
     * 删除通讯录信息
     *
     * @param sysContacts 通讯录对象
     * @return boolean
     * @date 2021/5/19 16:04
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean deleteSysContacts(List<SysContacts> sysContacts) {
        return sysContactsManager.deleteSysContacts(sysContacts);
    }

}
